<?php
/**
 * Teacher form
 *
 * @version $Id: Manager.php 73 2010-04-25 00:30:44Z yingkuang.chen@gmail.com $
 * @license New BSD License
 * @uses Zend_Form
 * @package admin
 * @subpackage Form
 */
class Admin_Form_Manager extends Sfs_Form
{

	protected $_formState;
	protected $_arrayData;
	/*
	function __construct($options=null){
		$locale = Bootstrap::$config['locale'];
		$path = dirname(__FILE__)."/../languages/$locale/data.ini";
		$ini = new Zend_Config_Ini($path);
		$this->_arrayData = $ini->get('array_data')->toArray();

		parent::__construct($options);
	}
	*/
	/**
	 * initialization routine
	 *
	 * @return void
	 */
	public function init()
	{
		$this->setMethod('post');
		$this->addElement('text', 'title', array(
					'label'      => 'title',
					'required'   => true,
					'filters'    => array('StringTrim','StripTags'),
					'validators' => array('NotEmpty'),
			)
		);
		$module = new Default_Model_Module();

		// 授權類別
		$roleKind = $module->getRoleKind();

        $translate = Zend_Registry::get('Zend_Translate');
		// 分類選單
		$moduleMenu = $module->getModuleMenu('',$translate->translate('topPage'));

		$arr = array(''=>'topPage');
		foreach($moduleMenu as $row)
			$arr[$row['resource_id']] = $row['title'];

		$this->addElement('select', 'parent_id', array(
					'label'      => 'belongTo',
	//				'required'   => true,
					'multiOptions'=>$arr
			)
		);
		$arr = array_merge(array(0=>'select ...'),$roleKind);
		$this->addElement('select', 'id_kind', array(
					'label'      => 'allowTo',
					'required'   => true,
					'multiOptions'=>$arr,
		//			'decorators'	=>$this->_noElementDecorator
			)
		);

		$this->addElement('select','allow',array(
			'label'=>'',
			'required'	=>true,
			'multiOptions'=>array(1=>'allow',0=>'deny'),
			'decorators'	=>$this->noElementDecorator
		));

		$this->addElement('hidden','resource_id',array(
		'decorators'	=>$this->noElementDecorator
		));

		$this->addElement('hidden','id',array(
		'decorators'	=>$this->noElementDecorator
		));


		$this->addElement('submit','save',array('label'=>'save'));
		//$this->getElement('allow')->setDecorators()
	}
}